//
//  YTTTabBarController.m
//  跑圈儿
//
//  Created by 唐康 on 16/4/19.
//  Copyright © 2016年 唐康. All rights reserved.
//

#import "YTTTabBarController.h"
#import "YTTRunroadController.h"
#import "YTTGroupController.h"
#import "YTTRunmapController.h"
#import "YTTWeatherController.h"
#import "YTTMeController.h"
#import "YTTNavigationController.h"
#import "YTTTabBar.h"
#import "YTTRunmapController.h"


@interface YTTTabBarController ()

@end

@implementation YTTTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tabBar.barTintColor = [UIColor whiteColor];
    YTTRunroadController *runroadVC = [[YTTRunroadController alloc]init];
    [self setupChildVC:runroadVC title:@"走啊走" image:@"run_road" selectedImage:@"run_road_click"];
    
    YTTGroupController *groupVC = [[YTTGroupController alloc]init];
    [self setupChildVC:groupVC title:@"群组" image:@"group" selectedImage:@"group_click"];
    
    YTTRunmapController *runmapVC = [[YTTRunmapController alloc]init];
    [self setupChildVC:runmapVC title:nil image:@"run_map" selectedImage:@"run_map_click"];
    
    YTTWeatherController *messageVC = [[YTTWeatherController alloc]init];
    [self setupChildVC:messageVC title:@"天气" image:@"weather" selectedImage:@"weather_click"];
    
    YTTMeController *meVC = [[YTTMeController alloc]init];
    [self setupChildVC:meVC title:@"我" image:@"me" selectedImage:@"me_click"];
    
   [self setValue:[[YTTTabBar alloc]init] forKeyPath:@"tabBar"];
  
    
}

-(void)setupChildVC:(UIViewController *)vc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage{
    
    vc.tabBarItem.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:image];
    vc.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage];
    YTTNavigationController *navi = [[YTTNavigationController alloc]initWithRootViewController:vc];
    [self addChildViewController:navi];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
